package com.augurit.wf.common.dao;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.augurit.common.base.dao.BaseDao;
import com.augurit.wf.client.opinion.convert.WfUserOpinionConvertor;
import com.augurit.wf.client.opinion.web.form.WfUserOpinionForm;
import com.augurit.wf.common.entity.WfUserOpinion;
@Repository
public class WfUserOpinionDao extends BaseDao<WfUserOpinion, Long> {
	/**
	 * 根据登陆用户id获取常用审批意见
	 * @param userId
	 * @return form对象列表
	 */
	public List<WfUserOpinionForm> getByUserId(Long userId){
		List<WfUserOpinionForm> formList = null;
		if(userId != null){
			String hql = "from WfUserOpinion ps where ps.userId="+userId + " order by ps.id desc";
			List<WfUserOpinion> entityList = this.find(hql);
			
			if(entityList != null && entityList.size()>0)
				formList = WfUserOpinionConvertor.convertVoListToFormList(entityList);
		}
		return formList;
	}
}